package com.servlet;


import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;

@WebServlet("/Day1031_4servlet")
public class Day1031_4servlet extends HttpServlet {
    @Override
    protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
        System.out.println("触发注解get请求");
        resp.setCharacterEncoding("utf-8");
        resp.setContentType("text/javascript;charest:utf-8");
        resp.getWriter().append("触发注解get请求");
    }



    @Override
    protected void doOptions(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
        System.out.println("触发注解post请求");
        resp.setCharacterEncoding("utf-8");
        resp.setContentType("text/javascript;charest:utf-8");
        resp.getWriter().append("触发注解post请求");
    }
}
